home *** CD-ROM | disk | FTP | other *** search
- Path: solon.com!not-for-mail
- From: seebs@solutions.solon.com (Peter Seebach)
- Newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++,comp.edu
- Subject: Re: ANSI C and POSIX (was Re: C/C++ knocks the crap out of Ada)
- Date: 8 Apr 1996 20:34:27 -0500
- Organization: Usenet Fact Police (Undercover)
- Message-ID: <4kcer3$mi4@solutions.solon.com>
- References: <JSA.96Feb16135027@organon.com> <dewar.828936837@schonberg> <4kb2j8$an0@solutions.solon.com> <4kbrt5$k3h@mulga.cs.mu.OZ.AU>
- Reply-To: seebs@solon.com
- NNTP-Posting-Host: solutions.solon.com
-
- In article <4kbrt5$k3h@mulga.cs.mu.OZ.AU>,
- Fergus Henderson <fjh@munta.cs.mu.OZ.AU> wrote:
- >It is clear that (a) such code is broken and (b) the fact that
- >it has undefined behaviour causes portability problems.
- >What you said and what Robert Dewar said are not contradictory.
-
- Yes, they are. There is no portability problem in the C language, or
- the behavior of read(). It is not a portability program for a mistake
- to behave randomly or differently on different machines.
-
- >>I can't see how this is a "portability problem" any more than it's a
- >>portability problem that some systems will crash on
- >> printf("%s", (char *) 0);
- >>... (SunOS won't, though.)
-
- >It is not *more* of a portability problem than `printf("%s", (char *) 0);',
- >but the undefined behaviour of read() and printf() both cause portability
- >problems.
-
- No, they define the boundaries of a language; things beyond that boundary
- are *supposed* to be undefined. Since no program in the C language ever
- runs into that behavior of a C implementation, it is not a portability
- problem.
-
- >>Something which works only on some systems is
- >>not a portability problem *if there is no standard saying it works*. Likewise
- >> i = ++i;
- >>producing different results on different machines is not a "portability
- >>problem".
-
- >Ha! Obviously you have never tried porting any serious C programs.
-
- Any program which does that is not a C program; it has left the bounds of
- defined behavior.
-
- Further, that behavior is a flat out bug; it is never correct, and the
- portability problem lies in the program, not the language spec. The
- program needs to be fixed.
-
- >>(This applies to most of the C standard library, as well, of course. The
- >>behavior you're used to, such as "void main(void)" or "fflush(stdin)" not
- >>working, is not a portability problem, it's broken code.)
-
- >It's a portability problem AND it's broken code.
-
- It's a portability problem if you write that broken code; well, don't do
- that then.
-
- No point blaming the language for incompetent or foolish programmers.
-
- -s
- --
- Peter Seebach - seebs@solon.com - Copyright 1996 Peter Seebach.
- C/Unix wizard -- C/Unix questions? Send mail for help. No, really!
- FUCK the communications decency act. Goddamned government. [literally.]
- The *other* C FAQ - http://www.solon.com/~seebs/c/c-iaq.html
-